from django.template import Library
from ..models import Category,Article

register = Library()


@register.inclusion_tag('side/category.html')
def categorys():
    return {
        'categorys': Category.objects.all()
    }


@register.inclusion_tag('side/recommend.html')
def recommends():
    return {
        'articles': Article.objects.filter(top=True).order_by('-update_time')
    }
